package Eyjafjalla.action;

import Eyjafjalla.patch.CloudPatch;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.GameActionManager;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;

public class DiscardTopHandAction extends AbstractGameAction {

    public DiscardTopHandAction() {
        this.duration = Settings.ACTION_DUR_FAST;
        this.actionType = ActionType.DISCARD;
        this.source = AbstractDungeon.player;
    }

    public void update() {
        if (this.duration == Settings.ACTION_DUR_FAST) {
            if (AbstractDungeon.player.hand.isEmpty()) {
                this.isDone = true;
                return;
            }
            AbstractCard card = AbstractDungeon.player.hand.getBottomCard();
            AbstractDungeon.player.hand.moveToDiscardPile(card);
            GameActionManager.incrementDiscard(false);
            card.triggerOnManualDiscard();

            this.isDone = true;
        }

    }
}


